package js;

import java.io.File;

import titt.TITTNuder;
import titt.service.content.Mimes;
import titt.service.content.NuderRequest;
import titt.service.content.NuderResponse;
import titt.util.Bytes;
import titt.util.debug.Printer;

public class Nuder {
	
	public NuderResponse post(int i, NuderRequest req) throws Exception {
		System.out.println();
		Printer.printHead(TITTNuder.getNuderHead());
				
		byte[] buf = new byte[req.getLength()];
		
		req.getStream().read(buf);
		
		System.out.println();
		System.out.println(Bytes.asString(buf));
		System.out.println();
		
		return new NuderResponse(""+i, Mimes.HTML);
	}
	
	public static void main(String[] args) throws Exception {
		Nuder n = TITTNuder.createProxy("test");
		n.post(2, new NuderRequest(new File("foo.txt")));
	}

}
